<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
	<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <script type="text/javascript">
		function reset_vendor(){
  			a = $('#vendor').combobox('getData');
  			if (a!=null && a.length>0){
				$('#vendor').combobox('setValue', a[0].vendorid);
 			}	
		}
		
		function reset_roleid(){
  			a = $('#roleid').combobox('getData');
  			if (a!=null && a.length>0){
				$('#roleid').combobox('setValue', a[0].roleno);
 			}
 			else{
 				$('#roleid').combobox('setValue', "");
 			}	
		}
		function reset_manager_info(){
		  reset_finger_temp();
		  $('#workno').val('');
		  $('#name').val('');
		  $('#identifyno').val('');
		  $('#address').val('');
		  $('#telephone').val('');
		}
		
		function panel_opend(){
			$('#vendor').combobox('reload','queryVendors.action');
		}
		
        function on_dept_select(node){
          $('#deptno').val(node.id);
          $('#deptno_val').val(node.id);
          $('#roleid').combobox('reload',
          	'queryRoleList.action?deptno='+node.id);
          $('#workno').focus();
        }
        function on_panel_close(){
          reset_manager_info();
          $("#sel_manager_dept_pane").panel("destroy");
        }
    	$(document).ready(function(){
    		set_input_keydown_event();
    		$('#roleid').combobox({onLoadSuccess:reset_roleid});
    		$('#del_finger_menu').menu();
    		
    		$('#depttree').tree({url:'queryDeptTree.action',onClick:on_dept_select,
    			onLoadError: function(){alert('系统错误，服务器可能已关闭！')}});
     		hook_finger_func();
    		$('#link_status').hide();
    		$('#vendor').combobox({onLoadSuccess:reset_vendor});
     		$('#add_manager_panel').panel({onClose:on_panel_close,onOpen:panel_opend});
			$('#sel_manager_dept_pane').panel();
			
     		$('#save').click(function (){
     		  $('#roleid_val').val($('#roleid').combobox('getValue'));
    		  $('#add_manager_form').form('submit', {
    		    url: 'addManager.action',error:function(message){
    		    	alert('提交数据错误，服务器可能已关闭！系统返回:'+message);
    		  	},
    		    success:function(data){
    		      var a = eval('(' + data + ')');
    		      $.messager.alert('增加管理员', a.message, 'info',
    		      	function(){$('#workno').focus()});
    		      
    		      if (a.result=='0'){
    		      	reset_manager_info();
    		      }
    		    }
    		    })
    		});

     		$('#cancel').click(function (){
     			reset_manager_info();
     			$('#add_manager_panel').panel('close');
    		});

			combobox_keypress2('#roleid','#vendor');
			combobox_keypress('#vendor', null);
    	});
    </script>
	</head>
	<body>

    <div id="add_manager_panel" fit="true" title="增加管理员" 
    	resizable="false" collapsible="false" minimizable="false" maximizable="false" 
    	closable="true" icon="icon-save" class="jquery_panel">
    	<s:form id="add_manager_form" action="addManager" cssStyle="margin:0px,0px" theme="simple">
    		<table height="100%">
    			<tr style="vertical-align: top">
    				<td width="280px"><div id="sel_manager_dept_pane" collapsible="false" fit="true" 
    					title="选择管理员机构" resizable="false" collapsible="false" minimizable="false" 
    					maximizable="false" noheader="false" closable="false"
    					style="margin:0px;padding:0px;overflow-y:scroll">
    					<ul id="depttree"></ul></div></td>
    				<td>
    					<s:include value="/app/finger_info.jsp"></s:include>
    					<table style="margin:10px,20px">
			    			<tr height="20px">
    							<td><s:label value="所属机构：" ></s:label></td>
			    				<td><input id="deptno" style="width:200px"
			    					class="text_field_css" disabled="disabled"></input>    						
    								<label style="width:4px"></label>
    								<label style="color:red">*</label><label>请选择</label>
    								<s:hidden id="deptno_val" name="deptno"/></td>
			    			</tr>
    						<tr height="20px">
			    				<td><s:label value="管理员号：" for="workno"></s:label></td>
    							<td><input id="workno" name="workno" style="width:200px"
    								maxlength=<s:property value="%{getText('MANAGER_WORKNO_LEN')}"/>  
			    					class="text_field_css"></input><label style="width:4px"></label>
			    					<label style="color:red">*</label><label>必输项</label></td>
    						</tr>
			    			<tr height="20px">
    							<td><s:label value="姓名：" for="name"></s:label></td>
			    				<td><input id="name" name="name" style="width:200px"
    								maxlength=<s:property value="%{getText('NAME_LEN')}"/>  
    								class="text_field_css"></input><label style="width:4px"></label>
    								<label style="color:red">*</label><label>必输项</label></td>
			    			</tr>
    						<tr height="20px">
			    				<td><s:label value="身份证号：" for="identifyno"></s:label></td>
    							<td><input id="identifyno" name="identifyno" style="width:200px" 
    								maxlength=<s:property value="%{getText('IDENTIFYNO_LEN')}"/>  
			    					class="text_field_css"></input><label style="width:4px"></label>
			    					<label style="color:red">*</label><label>必输项</label></td>
    						</tr>
    						<tr height="20px">
			    				<td><s:label value="住址：" for="address"></s:label></td>
    							<td><input id="address" name="address" style="width:250px" 
    								maxlength=<s:property value="%{getText('ADDRESS_LEN')}"/>  
			    					class="text_field_css"></input></td>
    						</tr>
    						<tr height="20px">
			    				<td><s:label value="电话：" for="telephone"></s:label></td>
    							<td><input id="telephone" name="telephone" 
    								maxlength=<s:property value="%{getText('TELEPHONE_LEN')}"/>  
			    					style="width:250px" class="text_field_css"></input></td>
    						</tr>
			    			<tr height="28px">
    							<td><s:label value="角色：" for="roleid"></s:label></td>
			    				<td><input id="roleid" editable="false" valueField="roleno" 
			    				  textField="rolename" style="width:250px" panelHeight="auto" 
			    				  url="queryRoleList.action"/>
			    				<s:hidden id="roleid_val" name="roleid"/></td>
			    			</tr>
    						<tr height="20px">
			    				<td><s:label value="指纹厂商:" for="vendor"/></td>
    							<td><input valueField="vendorid" textField="vendorname" 
			    					id="vendor" name="vendor" style="width:250px" editable="false"
    								class="easyui-combobox" panelHeight="auto"/></td>
			    			</tr>
    						<tr><td colspan="2"><s:include value="/app/finger_hand.jsp"></s:include></td></tr>
			    			<tr>
    							<td colspan="2" align="center">
            						<button id="save" class="buttons_css" style="width:70px">
            							<label style="70px" class="save_css">保存</label></button>
            						<label style="width:20px"></label>
            						<button id="cancel" class="buttons_css" style="width:70px">
            							<label style="70px" class="cancel_css">返回</label></button>
			    				</td>
    						</tr>
			    		</table>
    				</td>
    			</tr>
    		</table>
    	</s:form>
    </div>
    </body>
</html>